package com.campus.common.service;

import com.campus.common.domain.LoginUser;
import com.campus.common.dto.UserDto;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;

public interface UserService {
    public void registerByEmail(UserDto userDto);
    public void registerByPhoneNumber(UserDto userDto);

    public static Integer getUserId() {
        // 获取SecurityContextHolder中的用户id
        UserDto userDto =
                (UserDto) SecurityContextHolder.getContext().getAuthentication().getPrincipal();

        return userDto.getUserId();
    }
}
